import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_admin/api/odoo/mrp_production_odoo_api.dart';
import 'package:flutter_admin/pages/common/cry/model/response_body_api.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'data_grid.dart';

class ProductionIssue extends StatefulWidget {

  ProductionIssue({Key? key}):super(key: key);

  _ProductionIssueState createState() => _ProductionIssueState();
}

class _ProductionIssueState extends State<ProductionIssue>{

  List _dataList = [];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _loadData();
  }

  _loadData() async {
    ResponseBodyApi res = await MrpProductionOdooApi.productionIssueBoard();
    if(res.success!){
      _dataList = res.data;
      setState(() {});
    }
  }


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      alignment: Alignment.center,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage("assets/bg/bg8.jpg"),
          fit: BoxFit.cover,
        ),
      ),
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.all(10.r),
            child: Text("生产发料看板",style: TextStyle(
                fontSize: 36.sp,
                decoration: TextDecoration.none,
                color: Color.fromRGBO(255, 255, 255, 1)
            ),),
          ),
          _dataList.length==0?Text(""):Expanded(child: DataGrid(dataList: _dataList, scrollBars: 300,)),
        ],
      ),
    );
  }
}